package com.jingxing.provider;

import org.apache.commons.lang3.StringUtils;

/**
 * @author han
 * @title: PlayerUserInfoMapperProvider
 * @date 2021/9/15 14:47
 */
public class PlayerUserInfoMapperProvider {

    public String getPlayerUserInfos(String name, String phone){
        StringBuilder sql = new StringBuilder();
        sql.append("SELECT\n" +
                "  p.*,\n" +
                "\t( SELECT user_info.`name` FROM user_info WHERE id = p.sys_user_id ) AS sysUserName ");
        sql.append("FROM\n" +
                "\tplayer_user_info p ");
        sql.append("WHERE\n" +
                "\tdel = 0 ");
        if (StringUtils.isNotBlank(name)) {
            sql.append("AND p.`name` = '" + name + "' ");
        }
        if (StringUtils.isNotBlank(phone)) {
            sql.append("AND p.phone_number = '" + phone + "' ");
        }
        sql.append("ORDER BY p.rating DESC ");
        return sql.toString();
    }


}
